﻿cmake_minimum_required(VERSION 3.10)

# 设置C++标准
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 添加示例程序
add_executable(units_example units_example.cpp)

target_compile_definitions(units_example PUBLIC UNITS_STATIC_DEFINE)

# 链接依赖库
target_link_libraries(units_example libunits)

# set_property(GLOBAL	PROPERTY USE_FOLDERS ON)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out)

# 包含目录
target_include_directories(units_example PRIVATE
   ${CMAKE_CURRENT_SOURCE_DIR}/../lib/include
   $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

# 安装示例（可选）
install(TARGETS units_example
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}/examples
)

# 复制配置文件到构建目录
# configure_file(
#     ${CMAKE_CURRENT_SOURCE_DIR}/units_config.cfg
#     ${CMAKE_CURRENT_BINARY_DIR}/units_config.cfg
#     COPYONLY
# )
